package com.chuzhiyun.chengguoxy.widgets;

import android.app.Dialog;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import com.chuzhiyun.chengguoxy.R;
import androidx.annotation.RequiresApi;

@SuppressWarnings({"FieldCanBeLocal", "FieldMayBeFinal"})
public class InternshipshowView extends Dialog {

    public String message;
    @SuppressWarnings("FieldCanBeLocal")
    private boolean iscancelable;//控制点击dialog外部是否dismiss
    private boolean isBackCancelable;//控制返回键是否dismis
    private View view;
    private Context context;

    public InternshipshowView(Context context, View view, boolean isCancelable, boolean isBackCancelable) {
        super(context, R.style.MyDialog);
        this.context = context;
        this.iscancelable = isCancelable;
        this.view = view;
    }

    @RequiresApi(api = Build.VERSION_CODES.CUPCAKE)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(view);//这行一定要写在前面
        Window window = getWindow();
        setContentView(view);//这行一定要写在前面
        assert window != null;
        window.setGravity(Gravity.CENTER); // 此处可以设置dialog显示的位置为居中
        window.setWindowAnimations(R.style.MyDialog); // 添加动画效果
        setCanceledOnTouchOutside(false);
    }
}
